// 厨师类
let Cook = (function(){
    let instance = null
    function createCook(name,salary){
       Staff.call(this,name,salary)
       this.cookState = false
    }
    createCook.prototype ={
        construtor:createCook,
        doAJob:function(dishes){
          this.cookState = true
          // 显示要做的菜列表在某一区域
          let dishesDisplay = dishes
          // 已经做好菜的数量
          let dishOkNum = 0
          // 做菜时间间隔
          let time1 = 0 //对号是做完了以后在更新
          let time2 = 0 //正在做  是立刻更新
          for(let i=0;i<dishes.length;i++){
              time1 += Number(dishes[i].time)
              new Promise(function(resolve,reject){
                 let j = i
                 let dish = dishes[j]
                 setTimeout(function(){
                   resolve(dish)
                 },time1*t)
              }).then(res=>{
                dishOkNum++

              })
          }

        }
    }
})